﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.IO;
using System.Deployment.Application;
using ParsecParser;
using ParsecParser.Data;
using ParsecParser.Helpers;
using ParsecParser.Communication;
using ParsecParser.Display;
using ParsecClient.ParsecRaidWebService;

namespace ParsecClient.Classes
{
    public class ParsecDataExport
    {
        private static System.Xml.Serialization.XmlSerializer ParsecDataExportFileSerializer = new System.Xml.Serialization.XmlSerializer(typeof(ParsecDataExport));
        public TimerDefinitionCollection TimerDefs { get; set; }
        public CharacterSettingsCollection CharacterSettings { get; set; }
        public List<RaidGroup> RaidGroups { get; set; }
        public bool SettingsExported { get; set; }
        public string CombatLogFolder { get; set; }
        public bool ShowFilters { get; set; }
        public double MainWindowHeight { get; set; }
        public double MainWindowWidth { get; set; }
        public double MainWindowTop { get; set; }
        public double MainWindowLeft { get; set; }
        public string LastUsedRaidKey { get; set; }
        public bool MainTopMost { get; set; }
        public bool IsStreamMode { get; set; }
        public bool IsSoftwareRenderingMode { get; set; }
        public double MainOpacity { get; set; }
        public string RecentFiles { get; set; }
        public int TimerVolume { get; set; }
        public bool DefaultTimeServer { get; set; }
        public bool EnableTimeSync { get; set; }
        public string TimeServerHostName { get; set; }
        public int TimeServerPort { get; set; }
        public string RaidDetailsSortKey { get; set; }
        public void SaveToDisk(string filePath)
        {
            Serializer.SerializeDataToDisk(ParsecDataExportFileSerializer, this, filePath);
        }
        public static ParsecDataExport ReadExportFile(string filePath)
        {
            if (File.Exists(filePath))
            {
                return (ParsecDataExport)Serializer.DeserializeDataFromDisk(ParsecDataExportFileSerializer, filePath, false); 
            }
            else
                return null;
        }
    }
}
